import Vue from 'vue'
import VueRouter from 'vue-router'

//路由懒加载
const Home = () =>
  import ('../views/home/Home')
const Cate = () =>
  import ('../views/cate/Cate')
const Cart = () =>
  import ('../views/cart/Cart')
const ProFile = () =>
  import ('../views/profile/ProFile')
const Detail = () =>
  import ('../views/detail/Detail')

Vue.use(VueRouter)

const routes = [{
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/cate',
    component: Cate
  },
  {
    path: '/cart',
    component: Cart
  },
  {
    path: '/profile',
    component: ProFile
  },
  {
    path: '/detail/:iid',
    component: Detail
  }
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router